<!-- Student_studyWindow.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>师傅端评分列表</title>
		<link rel="stylesheet" type="text/css" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<style type="text/css" media="screen">
			.mui-table-view-cell:active {
				color: #222222;
			}
			.redPointMessage {
				top: 4px;
				left: 50px;
				display: none;
			}
			.mui-table-view .mui-media-object {
				line-height: 48px;
				max-width: 48px;
				height: 48px;
			}
			.mui-table-view-cell:active {
				color: #222222
			}
			.mui-media-body {
				color: #222222
			}
			.name_div {
			}
			.type_div {
				float: right;
			}
			.mui-table-view-chevron .mui-table-view-cell > a:not(.mui-btn) {
				margin-right: -105px;
			}
		   .user-icon{
			  border-radius: 50%;
			  height: 66px;
			  width: 66px;
			}
			
		</style>
	</head>
	<body>
		<div id="contentDiv" class="top_10">
			<ul class="mui-table-view mui-table-view-chevron base_grey base_content_font management  " id="list_div">
			<!--	<li  class="mui-table-view-cell mui-media"  style="position:relative;" onclick="openWin()">
					<a class='' href="javascript:;"> <img class="mui-media-object mui-pull-left"
					src="../../image/icon_teacher_normal.png">
					<div class="mui-media-body base_content_font">
						<span class="name_div">张三</span>
						<span class="type_div">待评分</span>
					</div> </a>
				</li>
				<li  class="mui-table-view-cell mui-media"  style="position:relative;">
					<a class='' href="javascript:;"> <img class="mui-media-object mui-pull-left"
					src="../../image/icon_teacher_normal.png">
					<div class="mui-media-body base_content_font">
						<span class="name_div">张三</span>
						<span class="type_div">已评分</span>
					</div> </a>
				</li>-->
			</ul>
			<div class="noSign"  id="noData" hidden="hidden">
				<img src="../../image/icon_img.png" width="60%" >
				<p class="font16 top_15 base_dark_grey" >
					暂无数据
				</p>
			</div>
			<div class="loadFailure" id="noNet"  hidden="hidden" >
				<img src="../../image/icon_img01.png" width="60%">
				<p class="" >
					数据加载失败qqq
				</p>
				<p>
					请检查您的网络
				</p>
				<button type="button" class="mui-btn mui-btn-outlined" onclick="RefreshData()">
					重新加载
				</button>
			</div>
		</div>
	</body>
	<script src="../../script/api.js" type="text/javascript"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script src="../../script/push.js" type="text/javascript"></script>
		<script type="text/javascript" src="../../script/timeStampTool.js"></script>
	<script src="../../script/common.js"></script>
	<script>
		var page = 1;
		var rows = 10;
		var refreshCount = 0;
		var sid = '';
		var firstLoad = true;
		apiready = function() {
		   loadNewData();
			setRefreshHeader();
			setPullUpRefresh();
			receNotifi();
//			sendBuriedNotifi('0', '师傅端评分列表页', '244')
		}
		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjid'),
				uname : $api.getStorage('cfnetppusername'),
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}
		
		
		function receNotifi() {
			api.addEventListener({
				name : 'MasterGradeListNotifi'
			}, function(ret, err) {
				refreshData();
			});
		}

		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				loadNewData();
			});
		}

		// 上拉加载
		function setPullUpRefresh() {
			api.addEventListener({
				name : 'scrolltobottom'
			}, function(ret, err) {
				if (refreshCount >= rows) {
					loadMoreData();
				}
			});
		}

		function loadNewData() {
			page = 1;
			loadData();
		}

		function loadMoreData() {
			page++;
			loadData();
		}

		//获取数据
		function loadData() {
			if (firstLoad == true) {
				showProgress();
				firstLoad = false;
			}
			var params = {
				jid : $api.getStorage('cfnetppjid'),
				uid : $api.getStorage('cfnetppuid'),
//              jid:337,
//				uid:144592,
				page : page,
				rows : rows
			};
			// console.log(JSON.stringify(params)+'\n'+url_getScoreList);
			cfnetppPOST(url_getScoreList, params, false, function(data, status) {
				api.hideProgress();
				api.refreshHeaderLoadDone();
				if (status == 'success') {
					if (data.code == 200) {
						var listdata = data.data;
						
						if (listdata != '' && listdata.constructor == Array && listdata.length > 0) {
							refreshCount = listdata.length;
							
							writelist(listdata, refreshCount);
						} else {
							if (page == 1) {
								$('#noData').show();
								$('#noNet').hide();
							}
						}
					} else if (data.code = 108) {
						if (page == 1) {
							$('#noData').show();
							$('#noNet').hide();
							$('#list_div').html('');
						}
					} else {
						if (page == 1) {
							$('#noData').show();
							$('#noNet').hide();
							$('#list_div').html('');
						}
					}
				} else {
					if (page > 1) {
						page--;
						refreshCount = rows;
						api.toast({
							msg : '网络异常'
						});
					} else {
						$('#noData').hide();
						$('#noNet').show();
						$('#list_div').html('');
					}
				}
			});
		}

		function refreshData() {
			firstLoad = true;
			loadNewData();
		}
         /*assessment_status 1 考核开始  0 未开始  -1 结束
         exam_status 1通过 0 未通过 -1 未考试
         exam_instime 交卷时间
         fenshu 考试得分*/
		function writelist(listdata, len) {
			var htmlsdata = '';
			var timeStr="";
			var typeStr="";
			for (var i = 0; i < len; i++) {
				var data = listdata[i];
				var DataArr = JSON.stringify(data).replace(/"/g, '&quot;');
				timeStr=timeWithStamp(data.instime);
				if(data.scores_status==1){
				  typeStr="已评分";
				}else{
				  typeStr="未评分";
				}
				var htmls ='<li  class="mui-table-view-cell mui-media"  style="position:relative;" onclick="openWin('+DataArr+')">'+
								'<a class=" href="javascript:;">'+ 
								'<img class="mui-media-object mui-pull-left user-icon" src="'+HeadPortraitIsNull(data.picurl)+'">'+
								'<div class="mui-media-body base_content_font">'+
									'<span class="name_div">'+data.rename1+'</span>'+
									'<span class="type_div">'+typeStr+'</span>'+
								'</div></a>'+
							'</li>';
				htmlsdata = htmlsdata + htmls;
			}
		
			if (page == 1) {
				$('#list_div').html(htmlsdata);
			} else {
				$('#list_div').append(htmlsdata);
			}
		}
		function openWin(data){
		    data['isagain']=false;
		    data['sourceurl'] = window.location.pathname;
			data['sourcetitle'] = document.title;
		    sendBuriedNotifi('1', '师傅端评分列表页', '244');
			api.openWin({useWKWebView:true,
				name: 'Practice_MasterGradeDetail',
				url: 'Practice_MasterGradeDetail.html',
				pageParam:data,
				allowEdit : true
			});
		    // if (data.scores_status == 1) {
		    // 	api.openWin({useWKWebView:true,
			//         name: 'Practice_MasterGradeDetail',
			//         url: 'Practice_MasterGradeDetail.html',
			//         pageParam:data,
			// 		allowEdit : true
		    //     });
		    // }else{
		    // 	api.openWin({useWKWebView:true,
			// 	    name: 'NewPracticeAppraise_win',
			// 	    url: '../NewPractice/NewPracticeAppraise_win.html',
			// 	    pageParam: data
			// 	});
		    // }
		}
	</script>
</html>